package com.outputstream;

import java.io.*;

/**
 * Version: 1.1
 * Author: TangJun
 * Date: 2024-07-28
 */
public class ObjectOut {
    public static void main(String[] args) throws IOException {
        //创建
        String fileParent = "D:\\CScode\\code\\java_code\\2024\\t0728\\src\\com";
        File fileName = new File(fileParent, "object.haha");
        ObjectOutputStream fileOut = new ObjectOutputStream(new FileOutputStream(fileName));
        //保存
        fileOut.writeInt(10);
        fileOut.writeUTF("hello");
        fileOut.writeObject(new T("hahahaha"));
        System.out.println("保存完成");
        //关闭
        fileOut.close();
    }
}
